package com.zhiyou.aifeng.viewmodel

import com.zhiyou.aifeng.common_ui.utils.applyCompletableSchedulers
import com.zhiyou.aifeng.common_ui.viewmodel.BaseViewModel
import io.reactivex.Completable
import java.util.concurrent.TimeUnit

class OrderViewModel : BaseViewModel() {

    fun cancelRequest() = mDisposables.clear()

    fun delay(
        time: Long = 300,
        onResult: () -> Unit = {}
    ) =
        Completable.timer(time, TimeUnit.MILLISECONDS)
            .compose(applyCompletableSchedulers())
            .subscribe { onResult() }

}